enum PlayEvent {
    PLAYER_EVT_OPEN,
    PLAYER_EVT_START,
    PLAYER_EVT_PAUSE,
    PLAYER_EVT_RESUME,
    PLAYER_EVT_STOP,
    PLAYER_EVT_CLOSE,
    PLAYER_EVT_FEED,
    PLAYER_EVT_PLAY_END,
}

interface PlayOptCallback {
    resolve: (data: any) => void;
    reject: (reason: any) => void;
    data?: any;
}

enum PlayState {
    PLAYER_OPENED_STATE,
    PLAYER_STARTED_STATE,
    PLAYER_PAUSED_STATE,
    PLAYER_CLOSED_STATE
}

enum EventType {
    REQ = 0x0100,
    RSP = 0x0200,
    IND = 0x0300
}

function buildPlayerReq(event: PlayEvent, data?: any) {
    return {evt: event | EventType.REQ, data: data};
}

function buildPlayerRsp(event: PlayEvent, data?: any) {
    return {evt: event | EventType.RSP, data: data};
}

function buildPlayerInd(event: PlayEvent, data?: any) {
    return {evt: event | EventType.IND, data: data};
}

export {PlayEvent, PlayOptCallback, PlayState, buildPlayerReq, buildPlayerRsp, buildPlayerInd}